

import sys
import wx

class Movewin(object):
    def __init__(self,aWxTextCtrl):
        self.out=aWxTextCtrl

    def write(self,string):
        self.out.WriteText(string)
    

class LogWin(wx.Dialog,wx.ListCtrl):

    def __init__(self,MoveList):
        wx.Dialog.__init__(self, None, wx.ID_ANY, "XBFM File Operations")

        # Add a panel so it looks the correct on all platforms
        panel = wx.Panel(self, wx.ID_ANY)
        logwin = wx.TextCtrl(panel, wx.ID_ANY, size=(400,300),
                          style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
        
        btn = wx.Button(panel, wx.ID_ANY, 'Push me!')
        self.Bind(wx.EVT_BUTTON, self.onButton, btn)

        # Add widgets to a sizer
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(log, 1, wx.ALL|wx.EXPAND, 5)
        sizer.Add(btn, 0, wx.ALL|wx.CENTER, 5)
        panel.SetSizer(sizer)

        # redirect text here
        redir=RedirectText(log)
        sys.stdout=redir

    def onButton(self, event):
        self.Close()


# Run the program
#if __name__ == "__main__":
#    app = wx.PySimpleApp(False)
#    frame = MyForm().Show()
#    app.MainLoop()
